package com.bnz.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 类名：
 * 作者：WF
 * 功能：购物项
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CartItem {
	private Product product;        // 所购买的某件商品
	private int num;                // 购买的某件商品的数量
	private double total;           // 某件商品的总金额

	public CartItem(Product product, int num) {
		this.product = product;
		this.num = num;
	}

	public void setTotal(double total) {
		this.total = this.num * product.getPrice();
	}
}
